<?php
/*  
  Copyright (c) 2010-02 SongCMS 
  SongCMS All Rights Reserved. 
  Support:www.SongCMS.com
  QQ:544255858   19951025
  Author:Song  Version:3.17
  Date:2010-08-12 09:28:32
*/
if (!empty($_POST['username'])){
	session_save_path(realpath('../tmp/sessions/')); session_start();
	include_once('../config/config.php'); include_once('../config/db.php');
	include_once('../config/admin.ini.php'); include_once('../inc/function.php');
	function __autoload($class_name){require_once '../class/' . $class_name . '.class.php';}
	$db = new db();
	$admin = new admin();
	$admin -> login($_POST['username'],$_POST['password'],$_POST['verifycode']);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>网站后台管理登录 - Powered by SongCMS</title>
<link href="images/adminstyle.css" rel="stylesheet" type="text/css" />
<script src="../js/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
if (top.location != self.location) top.location = self.location;
function xState(id,results){
	var oBj = (results) ? 'check_right.gif' : 'check_error.gif';
	oBj = '<img src="../images/' + oBj + '" />';
	document.getElementById(id).innerHTML = oBj;
};
function trim(str) {
	return str.replace(/(^[\s\u3000]*)|([\s\u3000]*$)/g,"");
};
function code(id){
	var codephp = '../inc/getcode.php';
	codephp = '<img src="' + codephp + '?' + id + '" />';
	return 	codephp;
};
$(document).ready(function(){
	$("#username input").change(function(){
		if(trim(this.value).length < 5){
			xState('usernametext',false);
		} else {
			$('#usernametext').html(null);
		}
	});
	$("#password input").change(function(){
		if(trim(this.value).length < 5){
			xState('passwordtext',false);
		} else {
			$('#passwordtext').html(null);
		}
	});
	$("#verifycode input").change(function(){
		if(trim(this.value).length < 4){
			xState('verifycodetext',false);
		} else {
			$('#verifycodetext').html(null);
		}
	});
	$("#verifycode input").focus(function(){
		$("#codeimg").html(code(Math.random()));
	});	
	$("#verifycode input").blur(function(){
		$("#codeimg").html(null);
	});	
	$("#reset img").click(function(){
		$("#usernametext").add("#passwordtext").add("#verifycodetext").add("#codeimg").html(null);	
		document.login.reset();
		return false;
	});
	$("form").submit(function(){
		var isSubmit = true;
		if(trim($("#username input").val()).length < 5){
			xState('usernametext',false);
			isSubmit = false;
		};
		if(trim($("#password input").val()).length < 5){
			xState('passwordtext',false);
			isSubmit = false;
		};
		if(trim($("#verifycode input").val()).length < 4){
			xState('verifycodetext',false);
			isSubmit = false;
		};		
		return isSubmit;
	}); 	
});
</script>
<style type="text/css">
html,body{background:url(images/login_gb.png) #000; padding:0; margin:0; color:#333;}
#framework{height:0px; width:0px; top:50%; left:50%; position:absolute; margin:-222px auto auto -204px;}
#framework #login{width:408px; height:444px; background:url(images/login.png) 0 0 no-repeat; overflow:hidden; padding:62px 0 0 155px; *padding:72px 0 0 155px; behavior:url(../tools/iepngfix/iepngfix.htc);}
#framework #login ul{clear:both; margin:11px 0 0 0; _margin:9px 0 0 0; height:19px;}
#framework #login ul img{margin:2px 0 0 10px;}
#framework #login ul li{float:left;}
#framework #login ul li input{padding:0 3px; width:178px; height:19px; line-height:16px; border:0; color:#666; font-size:12px; font-family:verdana, lucida,Arial, Helvetica, sans-serif;}
#framework #login ul #verifycode input{width:71px;}
#framework #login #button{margin:20px auto auto -6px; _margin-top:18px;}
#framework #login #button li input{width:66px; height:24px;}
#framework #login #button #submit{}
#framework #login #button #reset{margin:-2px 0 0 20px;}
#framework #login #button #reset img{cursor:pointer; width:66px; height:24px; border:0;}
#usernametext img,#passwordtext img,#verifycodetext img{width:13px; height:13px; border:0;}
#framework #login ul #codeimg{}
#framework #login ul #codeimg img{cursor:pointer; width:45px; height:20px; border:0; margin-top:-1px; *margin-top:0;}
</style>
</head>
<body>
<div id="framework">
	<form name="login" action="Login.php" method="post">
	<div id="login">
		<ul>
			<li id="username"><input name="username" type="text" value="" maxlength="20" /></li>
			<li id="usernametext"></li>
		</ul>
		<ul>
			<li id="password"><input name="password" type="password" value="" maxlength="20" /></li>
			<li id="passwordtext"></li>
		</ul>
		<ul>
			<li id="verifycode"><input name="verifycode" type="text" value="" maxlength="4" /></li>
			<li id="codeimg"></li>
			<li id="verifycodetext"></li>
		</ul>
		<ul id="button">
			<li id="submit"><input type="image" src="./images/submit.png" /></li>
			<li id="reset"><img src="./images/reset.png" /></li>
		</ul>
	</div>
	</form>
</div>
</body>
</html>